﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Frontdatabase.Migrations
{
    /// <inheritdoc />
    public partial class InitialCreate : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "bilibli_user",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false, comment: "自增主键")
                        .Annotation("SqlServer:Identity", "1, 1"),
                    NickName = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false, comment: "用户昵称 唯一索引"),
                    Email = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "用户邮箱"),
                    Phone = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "手机号码"),
                    Password = table.Column<string>(type: "nvarchar(max)", nullable: false, comment: "用户密码"),
                    Grade = table.Column<int>(type: "int", nullable: false, comment: "用户等级"),
                    Profile = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "用户头像图片地址"),
                    Remark = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "个性签名"),
                    IsLocked = table.Column<bool>(type: "bit", nullable: false, comment: "用户是否被封禁"),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false, comment: "用户是否注销"),
                    FansCount = table.Column<int>(type: "int", nullable: false, comment: "粉丝数"),
                    AttentionCount = table.Column<int>(type: "int", nullable: false, comment: "关注数"),
                    Create_Time = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "创建时间"),
                    UpDate_Time = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "更新时间")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_bilibli_user", x => x.Id);
                },
                comment: "用户表");

            migrationBuilder.CreateIndex(
                name: "IX_bilibli_user_NickName",
                table: "bilibli_user",
                column: "NickName",
                unique: true);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "bilibli_user");
        }
    }
}
